package com.egg.demo.controller.web;


import com.egg.basic.model.response.DateTest;
import com.egg.common.core.model.controller.WebController;
import com.egg.common.core.model.response.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

@Slf4j
@Api(tags = WebController.API_PREFIX + "时间")
@RestController
@RequestMapping("/date")
public class WebDateController extends WebController {


    @ApiOperation(value = "获取")
    @GetMapping
    public ResponseData<DateTest> get(
            @ApiParam(value = "年月日") @RequestParam(value = "yyyyMMdd", required = false) LocalDate yyyyMMdd
            , @ApiParam(value = "时分秒") @RequestParam(value = "HHmmss", required = false) LocalTime HHmmss
            , @ApiParam(value = "年月日时分秒") @RequestParam(value = "yyyyMMddHHmmss", required = false) LocalDateTime yyyyMMddHHmmss
    ) {
        DateTest dateTest = new DateTest();
        return ResponseData.success(dateTest);
    }

    @ApiOperation(value = "提交")
    @PostMapping
    public ResponseData<DateTest> post(@RequestBody DateTest dateTest) {
        return ResponseData.success(dateTest);
    }


}

